package com.yonyou.pmclouds.productactive.process;

import com.yonyou.iuap.print.client.business.PrintServer;
import com.yonyou.pmclouds.basecom.exception.BusinessException;
import lombok.extern.slf4j.Slf4j;

import java.util.HashMap;
import java.util.Map;

/**
 * 给租户初始化一套业务对象和模版，供云打印使用
 *
 * @author zhangzhonghao
 */
@Slf4j
public class PrintInitProcess {

    private String tenantId;

    public PrintInitProcess(String tenantId) {
        this.tenantId = tenantId;
    }

    public void initTenantBizz() throws BusinessException{
        Map<String, String> paramMap = new HashMap<>();
        paramMap.put("tenantId", tenantId);
        try {
            String result = PrintServer.execPost("/rest/print/initTenantBizz", paramMap, tenantId, "");
            log.info("init businessObject and template :" + result);
        }catch (Exception e){
            throw new BusinessException("init businessObject and template :" + e.getMessage());
        }
    }

}
